package constants

type ErrNo int

type ResultParams struct {
	Result ErrNo       `json:"result"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data"`
}

type CodeResultParams struct {
	Code ErrNo       `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

const (
	HTTP_RESULT_SUCCESS    = 0
	HTTP_FAIL_PARAMS_ERROR = 1001
	HTTP_FAIL_SYSTEM_ERROR = 1002
)

const (
	// 公共段
	SUCCESS                 ErrNo = 0  // 操作成功
	ERR_SYS                 ErrNo = 1  // 系统错误
	ERR_PARAM               ErrNo = 2  // 参数错误
	ERR_REQUEST_SIGN        ErrNo = 3  // 请求签名错误
	ERR_REQUEST_SOURCE_TYPE ErrNo = 4  // 请求来源错误      ErrNo = 3  // 请求签名错误
	ERR_USER_NOT_AUTH       ErrNo = 11 // 用户未认证
	ERR_IP_SOURCE           ErrNo = 12 // ip来源
	ERR_SERVER_STATUS_401   ErrNo = 13 // 服务器状态401
	ERR_SERVER_STATUS_403   ErrNo = 14 // 服务器状态403
	ERR_SERVER_STATUS_404   ErrNo = 15 // 服务器状态404
	ERR_SERVER_STATUS_500   ErrNo = 16 // 服务器状态500
	ERR_SERVER_STATUS_503   ErrNo = 17 // 服务器状态503

	// joyplay
	ERR_JOYPLAY_AUTH_HEADER_REQUIRED        ErrNo = 1001 // JoyPlay Authorization header is required
	ERR_JOYPLAY_AUTH_HEADER_FORMAT          ErrNo = 1002 // Invalid Authorization header format
	ERR_JOYPLAY_EXT_PARAM_MISSING           ErrNo = 1003 // ext 参数缺失
	ERR_JOYPLAY_EXT_PARAM_MAPPING_FAILED    ErrNo = 1004 // ext params failed to map
	ERR_JOYPLAY_REQUEST_DATA_DECRYPT_FAILED ErrNo = 1005 // request data decrypt failed
	ERR_JOYPLAY_JSON_UNMARSHAL_FAILED       ErrNo = 1006 // json Unmarshal failed
	ERR_JOYPLAY_EXT_PARAM_DECODING_FAILED   ErrNo = 1007 // ext params decoding failed
	ERR_JOYPLAY_INVALID_TOKEN               ErrNo = 1008 // Invalid token
	ERR_JOYPLAY_USER_NOT_EXIST              ErrNo = 1009 // User not exist
	ERR_JOYPLAY_DECODE_USER_FAILED          ErrNo = 1010 // Decode user failed
	ERR_JOYPLAY_COINS_NOT_EXIST             ErrNo = 1011 // Coins not exist
	ERR_JOYPLAY_KIWI_SUBMIT_FLOW_FAILED     ErrNo = 1012 // KIWI submit flow failed
	ERR_JOYPLAY_GET_LINKID_FAILED           ErrNo = 1013 // Get linkid failed
)
